<!-- 订单退还货 -->
<!-- yb 2023年4月5日 16:22 -->
<template>
  <div class="divv">
    <div class="div1">
      <div class="div2">
            <h3 style="width:100%; float:left;text-align: center; ">申请返修/退换货</h3>
            <p  style="width:100%; float:left;margin-left: 50px;margin-top: -10px;color: rgb(193 189 114);">联系客服请单击右下角黄色按钮</p> 
            <!-- <div class="div3">
              <el-input v-model="input" placeholder="请输入订单号" style="width:220px; float:right; margin-right: 140px;"></el-input>
              <el-button type="primary" icon="el-icon-search" style="width:100px; float:right; margin-right: -330px;">搜索</el-button>
            </div> -->
            <div class="div4">
              <div class="div5">
                <div class="div5-1">
                  <p style="text-align: center; line-height: 10px;">订单编号</p>
                </div>
                <div class="div5-2">
                  <p style="text-align: center; line-height: 10px;">商品名称</p>
                </div>
                <div class="div5-2">
                  <p style="text-align: center; line-height: 10px;">购买时间</p>
                </div>
                <div class="div5-2">
                  <p style="text-align: center; line-height: 10px;">商品状态</p>
                </div>
                <div class="div5-3">
                  <p style="text-align: center; line-height: 10px;">操作</p>
                </div>
              </div>
              <div v-for="(item,index) in SalesListData" :key="index" >
                <div class="div6" v-if="item.orderTypeId == 1">
                  <div class="div6-1">
                    <p style="text-align: center; font-size: 16px; line-height: 35px;">{{ item.orderNumber }}</p>
                  </div>
                  <div class="div6-2">
                    <p style="text-align: center; font-size: 16px; line-height: 20px;">{{ item.commodityName }}</p>
                  </div>
                  <div class="div6-2">
                    <p style="text-align: center; font-size: 16px; line-height: 35px;">{{ item.createTime }}</p>
                  </div>
                  <div class="div6-2">
                    <p style="text-align: center; font-size: 16px; line-height: 35px;">{{ item.status }}</p>
                  </div>
                  <div class="div6-3">
                    <el-button @click="updateOrder(item.id)" type="primary" style="width:100px; float:left; margin-left:55px; margin-top: 15px;">取消申请</el-button>
                    <!-- <el-button @click="saveFriend()" type="primary" style="width:100px; float:left; margin-left: 10px; margin-top: 15px;">联系客服</el-button> -->
                  </div>
                </div>
                <div class="div6" v-if="item.orderTypeId == 2">
                  <div class="div6-1" >
                    <p style="text-align: center; font-size: 16px; line-height: 35px;">{{ item.orderNumber }}</p>
                  </div>
                  <div class="div6-2">
                    <p style="text-align: center; font-size: 16px; line-height: 20px;">{{ item.diyName }}</p>
                  </div>
                  <div class="div6-2">
                    <p style="text-align: center; font-size: 16px; line-height: 35px;">{{ item.createTime }}</p>
                  </div>
                  <div class="div6-2">
                    <p style="text-align: center; font-size: 16px; line-height: 35px;">{{ item.status }}</p>
                  </div>
                  <div class="div6-3">
                    <el-button @click="updateOrder(item.id)" type="primary" style="width:100px; float:left; margin-left: 55px; margin-top: 15px;color: black; background-color: #FFF200;">取消申请</el-button>
                    <!-- <el-button @click="saveFriend()" type="primary" style="width:100px; float:left; margin-left: 10px; margin-top: 15px;">联系客服</el-button> -->
                  </div>
                </div>
              </div>
            </div>
      </div>
    </div>
</div>
</template>

<script>
export default {
    data() {
    return {
      // 获取售后信息
      SalesListData: [],
      // input: '',
    }
  },
mounted () {
  //获取用户id
  this.userId = window.sessionStorage.getItem('userId')
  this.getAfterSalesList()
},
methods: {
  //取消售后
  updateOrder (id) {
    this.$confirm('是否删除这条数据', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'waning'
      }).then(() => {
        this.$axios.delete('/order/updateOrder', {
          params: {
            id: id
          }
        }).then(res => {
          if (res.data.flag) {
            this.getAfterSalesList()
          } else {
            this.myMessage('warning', '取消失败!')
          }
        })
      }).catch(() => {
        this.myMessage('info', '已取消删除')
      })
  },
  //获取售后信息
  getAfterSalesList () {
     this.$axios.get("/order/getAfterSalesList", {
        params: {
            userId: this.userId
        }
    }).then(res => {
      if (res.data.flag){
          this.SalesListData= res.data.data
      }
    }).catch(() => {
        this.$message.error('获取信息失败！')
    }) 
  },
  
    // saveFriend () {
    //   this.$alert('请点击右下角客服按钮', '客服', {
    //       confirmButtonText: '关闭',
    //       callback: action => {
    //         this.$message({
    //           type: 'info',
    //           message: `action: ${ action }`
    //         });
    //       }
    //     });
    // },
   // 客服
  //  saveFriend () {
  //   this.id=4
  //   this.$axios.post('/customer/saveFriend?id='+ this.id)
  //     .then(res => {
  //       this.$router.push({path: '/Customer'})
  //       this.message('成功连接', 'success')
  //     }).catch(() => {
  //       this.$message.error('发送信息失败！')
  //     })
  // },
  // 消息提示框
  message (message, type) {
    this.$message({
      message: message,
      type: type
    })
  }
}
}
</script>

<style scoped>
.divv{
    width: 100%;
    height: 100%;
}
.div1{
    width: 100%;
    height: 750px;
    margin: auto;
}
    
.div2{
    width: 100%;
    height: 100%;
    background: #ffffff;
    margin: auto;
}
.div3{
    width: 100%;
    height: 50px;
    float: left;
}
.div4{
    width: 1250px;
    height: 550px;
    float: left;
    margin-left: 35px;
}
.div5{
    width: 1250px;
    height: 40px;
    float: left;
}
.div5-1{
  width: 320px;
  height: 100%;
  border: 1px solid #070707;
  float: left;
}
.div5-2{
  width: 161px;
  height: 100%;
  border: 1px solid #070707;
  border-left:0px;
  float: left;
}
.div5-3{
  width: 220px;
  height: 100%;
  border: 1px solid #070707;
  border-left:0px;
  float: left;
}
.div5-4{
  width: 101px;
  height: 100%;
  border: 1px solid #070707;
  border-left:0px;
  float: left;
}
.div6{
    width: 1250px;
    height: 80px;
    float: left;
    /* background: #f1c0c0; */
}
.div6-1{
  width: 320px;
  height: 100%;
  border: 1px solid #070707;
  border-top: 0px;
  float: left;
}
.div6-2{
  width: 161px;
  height: 100%;
  border: 1px solid #070707;
  border-left:0px;
  border-top: 0px;
  float: left;
}
.div6-4{
  width: 101px;
  height: 100%;
  border: 1px solid #070707;
  border-left:0px;
  border-top: 0px;
  float: left;
}
.div6-3{
  width: 220px;
  height: 100%;
  border: 1px solid #070707;
  border-top: 0px;
  border-left:0px;
  float: left;
}
</style>